
export default {

  namespace: 'example',

  state: {
    list:[]
  },

  subscriptions: {
    setup({ dispatch, history }) {  // eslint-disable-line
    },
  },

  effects: {//处理异步
    *fetch({ payload }, { call, put }) {  // eslint-disable-line
      console.log('fetch.payload...',payload)
      let num = yield new Promise((resolve,reject)=>{
          setTimeout(function(){
            resolve(100)
          },1000)
      })
      console.log('num..',num);
      let num2 = yield new Promise((resolve,reject)=>{
          setTimeout(function(){
            resolve(200)
          },2000)
      })
      console.log('num2..',num2);
      yield put({ type: 'save' });
    },
  },

  reducers: {//处理同步
    save(state, action) {
      console.log('save.action...',action)
      return { ...state, ...action.payload };
    },
  },

};
